var daoBase = require('../../core/database/daoBase');
var utility = require('../../core/utilities/utilities');
class ArticleApiModel extends daoBase {

    /*
    * 获取文章详情
    */
    getArticleDetail(param) {
        let sqlCommand = "select article_id id, article_title title, article_image image,date_format(article_date, '%Y-%m-%d') date from bus_article where article_id = ?";
        return this.database.executeSql(sqlCommand, [param.id]);
    }

    /*
    * 获取文章列表
    */
    getArticleList(params) {
        let sqlCommand = "call proc_article_list(?,?,?);";
        var paramData = [params.appId, params.page, params.rows];
        return this.database.executeSql(sqlCommand,paramData)
            .then(result => {
            return{
                successed:true,
                data:result.rows
            };
    });
    }


}
exports = module.exports = ArticleApiModel;